﻿package org.xhs.lib.utils
{
    import flash.external.*;
    import flash.net.*;

    public class BrowserUtil extends Object
    {

        public function BrowserUtil()
        {
            return;
        }// end function

        public static function openNewWindow(param1:String, param2:String = null) : void
        {
            var url:* = param1;
            var windowName:* = param2;
            try
            {
                if (ExternalInterface.objectID)
                {
                    if (windowName)
                    {
                        ExternalInterface.call("window.open", url, windowName);
                    }
                    else
                    {
                        ExternalInterface.call("window.open", url);
                    }
                }
                else
                {
                    throw new Error();
                }
            }
            catch (e:Error)
            {
                navigateToURL(new URLRequest(url), "_blank");
            }
            return;
        }// end function

    }
}
